package com.yuwenxin.bean;

import com.yuwenxin.bean.enumPackage.Gender;
import com.yuwenxin.core.PasswordEncodeUtil;

import java.util.Date;
import java.util.HashSet;

public class User {
    private int id;
    private String name, password, email, sex, phoneNum, realName, idCard, introduction;
    private String headPhotoPath;
    private boolean isValidate, isAdmin;
    private Date registerDate, latestLoginDate;

    // 可修改属性：name,password,sex,introduction,idValidate,isAdmin,latestLoginDate

    private HashSet<MusicList> musicLists; // 这里初步设计默认有如下6个音乐列表 listenedMusic, collectedMusic, likedMusic, boughtMusic, postMusic, sharedMusic;
    private HashSet<User> friends = new HashSet<>(); // 多对多关系表
    private HashSet<FriendList> friendLists; //初步设计默认有“我的好友”一个列表，允许用户自定义好友列表

    private Gender gender;


    public HashSet<MusicList> getMusicLists() {
        return musicLists;
    }

    public void setMusicLists(HashSet<MusicList> musicLists) {
        this.musicLists = musicLists;
    }

    public String getHeadPhotoPath() {
        return headPhotoPath;
    }

    public void setHeadPhotoPath(String headPhotoPath) {
        this.headPhotoPath = headPhotoPath;
    }

    public Gender getGender() {
        return gender;
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    public Date getLatestLoginDate() {
        return new Date();
    }

    public void setLatestLoginDate(Date latestLoginDate) {
        this.latestLoginDate = latestLoginDate;
    }


    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introdustion) {
        this.introduction = introdustion;
    }

    public boolean isAdmin() {
        return isAdmin;
    }

    public void setAdmin(boolean admin) {
        isAdmin = admin;
    }

    // 这一行代码是用于JSTL标签的取值判断。。。
    // 因为jstl取值{$user.isAdmin}直接根据bean类中的get方法来获取的
    // 不得不说这很不智能，可能后面的validate也要进行一系列的修改了QAQ
    public boolean getisAdmin() {
        return isAdmin;
    }

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }

    public boolean isValidate() {
        return isValidate;
    }

    public void setValidate(boolean validate) {
        isValidate = validate;
    }

    public HashSet<User> getFriends() {
        return friends;
    }

    public void setFriends(HashSet<User> friends) {
        this.friends = friends;
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = PasswordEncodeUtil.encodePassword(password);
    }

    //这个方法用于加密密码后的验证（dao层的toentity如果使用setPassword会导致反复加密）  --9.20
    public void setPasswordDirect(String password){
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", email='" + email + '\'' +
                ", sex='" + sex + '\'' +
                ", phoneNum='" + phoneNum + '\'' +
                ", realName='" + realName + '\'' +
                ", idCard='" + idCard + '\'' +
                ", introduction='" + introduction + '\'' +
                ", headPhotoPath='" + headPhotoPath + '\'' +
                ", isValidate=" + isValidate +
                ", isAdmin=" + isAdmin +
                ", registerDate=" + registerDate +
                ", latestLoginDate=" + latestLoginDate +
                '}';
    }
}
//    public MusicList getListenedMusic() {
//        return listenedMusic;
//    }
//
//    public void setListenedMusic(MusicList listenedMusic) {
//        this.listenedMusic = listenedMusic;
//    }
//
//    public MusicList getCollectedMusic() {
//        return collectedMusic;
//    }
//
//    public void setCollectedMusic(MusicList collectedMusic) {
//        this.collectedMusic = collectedMusic;
//    }
//
//    public MusicList getLikedMusic() {
//        return likedMusic;
//    }
//
//    public void setLikedMusic(MusicList likedMusic) {
//        this.likedMusic = likedMusic;
//    }
//
//    public MusicList getBoughtMusic() {
//        return boughtMusic;
//    }
//
//    public void setBoughtMusic(MusicList boughtMusic) {
//        this.boughtMusic = boughtMusic;
//    }
//
//    public MusicList getPostMusic() {
//        return postMusic;
//    }
//
//    public void setPostMusic(MusicList postMusic) {
//        this.postMusic = postMusic;
//    }
//
//    public MusicList getSharedMusic() {
//        return sharedMusic;
//    }
//
//    public void setSharedMusic(MusicList sharedMusic) {
//        this.sharedMusic = sharedMusic;
//    }
//
//    public MusicList getMusicList() {
//        return musicList;
//    }
//
//    public void setMusicList(MusicList musicList) {
//        this.musicList = musicList;
//    }